package api

import (
	"2302a/chatroom/api/handler"
	"2302a/chatroom/consts"
	"2302a/chatroom/pkg"
	"github.com/gin-gonic/gin"
)

func LoadRouter(r *gin.Engine) {
	api := r.Group("api")
	{
		user := api.Group("user")
		{
			user.POST("/register", handler.UserRegister)
			user.POST("/login", handler.UserLogin)
		}
		chat := api.Group("chat")
		{
			chat.Use(pkg.GetAuthToken(consts.JWT_KEY))
			chat.GET("/ws/chatroom", handler.Chat)
		}
	}
}
